import axios from 'axios'
// 配置请求的根路径
axios.defaults.baseURL = 'http://127.0.0.1:8900/'
// 通过axios请求拦截器添加token
axios.interceptors.request.use(config => {
  // console.log(config)
  config.headers.Authorization = 'JWT ' + window.sessionStorage.getItem('token')
  return config
})

export function get(url, params) {
  return axios.get(url, {
    params: params
  })
}
export function post(url, data) {
  return axios.post(url, data)
}

export function del(url, params) {
  return axios.delete(url)
}

export function put(url, data) {
  return axios.put(url)
}
